package com.ttt.adbgui.jcomp;

import com.teamdev.jxbrowser.browser.Browser;
import com.teamdev.jxbrowser.engine.Engine;
import com.teamdev.jxbrowser.engine.EngineOptions;
import lombok.Data;
import org.springframework.stereotype.Component;
import javax.swing.*;
import java.util.ArrayList;

import static com.teamdev.jxbrowser.engine.RenderingMode.HARDWARE_ACCELERATED;

@Data
@Component
public class JFrameComponent {

    private JFrame jFrame = new JFrame("ADB GUI");
    // dialog
    private JFrame dialogFrame = new JFrame("ADB GUI");
    private JPanel contentPane = new JPanel();
    private JDesktopPane leftDesktopPane = new JDesktopPane();
    private JDesktopPane rightDesktopPane = new JDesktopPane();
    private JLabel jLabelSelect = new JLabel("选择设备");
    private JLabel jLabelDevices = new JLabel("快捷操作");
    private JLabel jLabelFile = new JLabel("文件管理");
    private JLabel jLabelMonkey = new JLabel("ADB Monkey");
    private JLabel jLabelMonitor = new JLabel("性能监控");
    private JComboBox<String> jComboBoxDevices = new JComboBox<String>();
    private JList<String> jList = new JList<String>();

    /*
    * 快捷操作
    * */
    private JTable table = new JTable(0, 2);
    private JTextPane textPane = new JTextPane();
    private JScrollPane jScrollPane;

    /*
    * 文件管理
    * */
    private JTable tableFile = new JTable(0,1);
    private JScrollPane jScrollPaneFile;
    private String deviceName = ""; // 当前显示的设备名称
    private ArrayList<String> resultStr = new ArrayList<>();    // 文件操作返回的列表
    private String fileParentPath = ""; // 当前文件列表的父级路径
    private JEditorPane editorPane = new JEditorPane(); // 性能监控窗口
    private JScrollPane jScrollEditorPane;

    // jxbrowser认证key信息注册（试用已过期）
    // private Engine engine = Engine.newInstance(EngineOptions.newBuilder(HARDWARE_ACCELERATED).build());
    // private Browser browser = engine.newBrowser();

    /*
    * Adb Monkey
    * rightPanel component
    * */
    private JTextPane packageName = new JTextPane();    // 包名
    private JTextPane logLevel = new JTextPane();   // 日志级别
    private JTextPane stepDelay = new JTextPane();  // 步骤延迟
    private JTextPane seedValue = new JTextPane();  // seed
    private JTextPane functionNum = new JTextPane();    // 事件数量
    private JTextPane logPath = new JTextPane();    // 日志保存位置
    private JTextField packageNameField = new JTextField(); // 包名输入
    private JTextField logLevelField = new JTextField();    // 日志级别输入
    private JTextField stepDelayField = new JTextField();   // 步骤延迟输入
    private JTextField seedValueField = new JTextField();   // seed输入
    private JTextField functionNumField = new JTextField(); // 事件数量输入
    private JTextField logPathField = new JTextField(); // 日志保存位置输入
    private JButton startButton = new JButton("执行"); //
    private JButton catLog = new JButton("打开日志文件"); //
    private JTextArea adbMonkeyTextArea = new JTextArea();
    private JScrollPane jScrollPaneMonkey = new JScrollPane();

}
